#region - Class details -
/*  
 *  Developer   : Wicus Botha
 *  Description : 
 *  History     : WB - 2008-06-16 - Created
 */
#endregion

using System;
using System.Data.Common;
using IQ.DbBase;

namespace IQ.DbBase.GlobalSettings
{
	/// <summary>
	/// Description of Connections.
	/// </summary>
	public static class Connections
	{
		public static string ConnectionString;
		public static ConnectionTypes ConnectionType;
		public static DbConnection Connection;
		//
		public static DbConnection GetConnection(ConnectionTypes connectionType, string connectionString)
		{
			switch (connectionType) 
			{
				case ConnectionTypes.SqlServer : return new System.Data.SqlClient.SqlConnection(connectionString);
				case ConnectionTypes.Odbc      : return new System.Data.Odbc.OdbcConnection(connectionString);
				case ConnectionTypes.OleDB     : return new System.Data.OleDb.OleDbConnection(connectionString);
				default: return null;							
			}
		}
		public static DbConnection GetConnection()
		{
			return GetConnection(ConnectionType, ConnectionString);
		}		
	}
}
